<template>
  <nf-button
    v-bind="buttonMeta"
    :componentKind="componentKind"
    :active="active"
    :moduleId="moduleId"
    :dataId="selection.dataId"
    :dataIds="selection.dataIds"
  >
  </nf-button>
</template>

<script>
  import { reactive, defineAsyncComponent } from 'vue'
  import { lifecycle } from '/nf-ui-core'
  import _buttonMeta from '../../button/button.json'
  // import myForm from './form.vue'
  // import list from '../listPage.vue'

</script>

<script setup>
  lifecycle('操作按钮', true)
 
  const props = defineProps({
    moduleId: Number,
    selection: Object,
    active: Object
  })

  console.log('操作按钮的属性', props)
  const buttonMeta = reactive(_buttonMeta)

  buttonMeta.events = {
    deleteClick: (id, meta) => {
      // console.log('按了删除按钮：', id, meta)
      return true
    }
  }

  // 弹窗打开的组件的字典
  const componentKind = {
    form: defineAsyncComponent(() => import('./form.vue')),
    list: defineAsyncComponent(() => import('../listPage.vue'))
  }

</script>